<?php
Yii::app()->clientScript->registerScriptFile($this->adminPath."/js/art-dialog/jquery.artDialog.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->adminPath."/js/art-dialog/plugins/iframeTools.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->adminPath."/js/jquery-ui-1.8.11.custom.min.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->adminPath."/js/jquery.validationEngine.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->adminPath."/js/jquery.validationEngine-zh_CN.js",CClientScript::POS_HEAD);
?>
    <link rel="stylesheet" type="text/css" href="<?php echo $this->adminPath; ?>/css/jquery-ui.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $this->adminPath; ?>/css/jquery.ui/jquery.ui.theme.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $this->adminPath; ?>/css/jquery.ui/jquery.ui.tabs.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $this->adminPath; ?>/js/art-dialog/skins/blue.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $this->adminPath; ?>/js/validationEngine.jquery.css" />
    <!-- page title -->
    <div class="page-title" style="z-index: 780;">
        <div class="in" style="z-index: 770;">
            <div class="titlebar" style="z-index: 760;">
                <h2 class="title">首页侧导航管理</h2>
                <p>更改首页侧导航。</p></div>

            <div class="clear" style="z-index: 740;"></div>
        </div>
    </div>
    <style>
        .grid-view {
            padding: 0;
        }
        table.tablesorters {
            background-color: #CDCDCD;
            font-family: arial;
            font-size: 12px;
            margin: 0 0;
            text-align: left;
            width: 100%;
        }
        table.tablesorters thead tr th {
            background-position: right center;
            background-repeat: no-repeat;
            color: #333333;
            cursor: pointer;
        }
        table.tablesorters tbody td {
            padding: 12px;
            vertical-align: middle;
        }
        table.tablesorters tbody td {
            border: 1px solid #D8E4E9;
            color: #6C7D8C;
            padding: 12px;
            vertical-align: top;
        }
        table.tablesorters thead tr th, table.tablesorter tfoot tr th {
            -moz-border-bottom-colors: none;
            -moz-border-left-colors: none;
            -moz-border-right-colors: none;
            -moz-border-top-colors: none;
            background: url("<?php echo $this->adminPath; ?>/img/tableshorter/titlebg.png") repeat-x scroll center bottom #EFF3F8;
            border-color: -moz-use-text-color #CBDAE8;
            border-image: none;
            border-left: 1px solid #CBDAE8;
            border-right: 1px solid #CBDAE8;
            border-style: none solid;
            border-width: medium 1px;
            font-size: 8pt;
            padding: 12px;
        }
        table.tablesorters tbody tr.odd {
            background-color: #FFFFFF;
        }
        table.tablesorters tbody tr:hover {
            background-color: #E4ECF3;
        }
        .newLoding{
            background: url("<?php echo $this->adminPath; ?>/img/loading/6.gif") no-repeat scroll center bottom #EFF3F8;
        }
        .page.selected a{
            background:#3E7CAC ;
            color:#FFFFFF;
        }
        .grid-view .button-column {
            text-align: center;
            width: 30px;
        }
        .tablesorters {
            border: 1px solid #d8e4e9;
            font-family: arial;
            font-size: 12px;
            margin: 0;
            text-align: left;
            width: 100%;
        }
        .st-form-line label{
            display: block;
            float: left;
            width: 120px;
        }
    </style>

    <div class="content">
        <div style="z-index: 500;" class="simplebox grid740">
            <div style="z-index: 490;" class="titleh">
                <h3>首页侧导航</h3>
            </div>
            <div id="tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all" style="z-index: 590;">
            <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
                <li class="ui-state-default ui-corner-top"><a href="<?php echo Yii::app()->createUrl('admin/front/nav',array('tabs'=>1)) ?>">去哪儿</a></li>
                <li class="ui-state-default ui-corner-top"><a href="<?php echo Yii::app()->createUrl('admin/front/nav',array('tabs'=>2)) ?>">玩什么</a></li>
                <li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="javascript:void(0);">热门地</a></li>

            </ul>
                <form id="form"  method="post" >
                <div id="tabs-1" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="z-index: 580;">
                    <div class="st-form-line" style="z-index: 580;">
                        <div class="albox informationbox" style="z-index: 680;">
                            <b>提示 :</b> 勾选需要在首页显示的热门地.只保存勾选过的数据
                        </div>
                        <div style="width: 850px; float: left;">

                        <?php foreach($address_array as $v){ ?>
                            <div style="width: 115px; height: 120px;float: left;margin-right: 10px; margin-bottom: 0; " class="albox dialogbox app-item tips">

                                <label><input <?php if($v->id == $id_array[$v->id]){ ?>checked="checked"<?php } ?>  type="checkbox" name="hot[<?php echo $v->id; ?>]"  value="<?php echo $v->title; ?>"><?php echo $v->title; ?></label>
                                <label>简称:<input <?php if($v->id == $id_array[$v->id]){ ?>value="<?php echo $title_array[$v->id] ?>"<?php } ?>  style="width: 100px" name="title[<?php echo $v->id; ?>]" type="text" ></label>
                                 <label>排序:<input <?php if($v->id == $id_array[$v->id]){ ?>value="<?php echo $order_array[$v->id] ?>"<?php } ?> style="width: 100px" name="listorder[<?php echo $v->id; ?>]" type="text" ></label>
                  <?php
                    if($v->type=='酒店'){
                        $jd = 'hotel';
                    }elseif($v->type=='农家院'){
                        $jd = 'farm';
                    }elseif($v->type=='度假村'){
                        $jd = 'resort';
                    }elseif($v->type=='采摘园'){
                        $jd = 'pick';
                    }else{
                        $jd = 'destination';
                    }
                  ?>
                                <input value="<?php echo $jd; ?>" name="type[<?php echo $v->id; ?>]" type="hidden" >
                                <input value="<?php echo $v->token; ?>" name="token[<?php echo $v->id; ?>]" type="hidden" >
                                <div class="clear" style="z-index: 570;"></div>
                            </div>
                        <?php } ?>
                            <div class="clear" style="z-index: 570;"></div>
                        </div>
                        <div class="clear"></div>
                    </div>
                    <div class="st-form-line button-box" style="z-index: 460;">
                        <input type="submit" class="st-button" value="保存" id="submit" name="button">
                    </div>
                </div>
                </form>
            </div>
        </div>

    </div>
<script type="text/javascript">
    $(function(){
        $("#form").validationEngine({
            ajaxFormValidation: true,
            ajaxFormValidationURL: '<?php echo Yii::app()->createAbsoluteUrl('admin/front/updateHot'); ?>',
            ajaxFormValidationMethod: "post",
            //validateNonVisibleFields:true,//验证隐藏字段
            onBeforeAjaxFormValidation: function (form, options) {
                art.dialog.Talert('数据交互中ing', 5);
            },
            onAjaxFormComplete: function (status, form, json, options) {
                if (json['status'] == 1) {
                    art.dialog.Talert(json['message']);
                    window.location.reload();
                } else {
                    art.dialog.Talert(json['message']);
                }
            }

        });
    });
</script>